package com.guigu.lc.controller;

import com.guigu.common.pojo.MDesignProcedure;
import com.guigu.common.pojo.MDesignProcedureDetails;
import com.guigu.common.vo.SearchVo;
import com.guigu.lc.serach.changeproductionprocessSerach;
import com.guigu.lc.service.productionprocessesService;
import com.guigu.lc.view.mdesignprocedureview;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 *产品生产工序设计单审核，产品生产工序设计单查询，产品生产工序设计单变更的Controller
 */
@Controller
@RequestMapping("/lc")
public class productionprocessesController {

    @Resource
    private productionprocessesService productprocessService;


    /**
     * 产品生产工序设计单审核表并分页显示
     */
    @RequestMapping("/querycheckproductionprocesses")
    @ResponseBody()
    public SearchVo<MDesignProcedure> productionprocessesService(SearchVo<MDesignProcedure> searchVo){
        return this.productprocessService.queryBycheckService(searchVo);
    }

    /**
     *产品生产工序设计单查询分页显示
     * @param searchVo
     * @return
     */
    @RequestMapping("/qqueryallproductionprocesses")
    @ResponseBody()
    public SearchVo<MDesignProcedure> qqueryallproductionprocesses(SearchVo<MDesignProcedure> searchVo){
        return this.productprocessService.queryproductionallService(searchVo);
    }

    /**
     * 产品工序变更查询
     * @param serach
     * @return
     */
    @RequestMapping("/querychangeproductionprocesses")
    @ResponseBody()
    public changeproductionprocessSerach querychangeproductionprocesses(changeproductionprocessSerach serach){
        return this.productprocessService.querychangeproductionService(serach);
    }

    /**
     * 产品工序审核查询明细表
     */
    @RequestMapping("/queryByidcheckmingxi")
    @ResponseBody()
    public List<MDesignProcedureDetails> queryByidcheckmingxi(int id){
       return this.productprocessService.queryByproductioncheckmingxiService(id);
    }

    /**
     * 产品工序审核通过
     */
    @RequestMapping("/shenghecheckok")
    @ResponseBody()
    public int shenghecheckok(@RequestBody()mdesignprocedureview mdesignprocedureview){
       this.productprocessService.productshengheok(mdesignprocedureview);
        return 1;

    }

    /**
     * 产品工序审核未通过
     */
    @RequestMapping("/shenghecheckno")
    @ResponseBody()
    public int shenghecheckno(@RequestBody() mdesignprocedureview mdesignprocedureview){
        this.productprocessService.productshengheno(mdesignprocedureview);
        return 1;
    }

    /**
     * 产品工序变更：未做工序物料设计 工序物料设计未设计
     */
    @RequestMapping("/changenosheji")
    @ResponseBody()
    public int changenosheji(@RequestBody() mdesignprocedureview mdesignprocedureview){
        this.productprocessService.changenoshejiService(mdesignprocedureview);
        return 1;
    }

    /**
     * 产品工序审核：未做工序物料设计 工序物料设计已设计
     * @param mdesignprocedureview
     * @return
     */
    @RequestMapping("/changeoksheji")
    @ResponseBody()
    public int changeoksheji(@RequestBody() mdesignprocedureview mdesignprocedureview){
        this.productprocessService.changeokshejiService(mdesignprocedureview);
        return 1;
    }
}
